#ifndef _RESTCLIENT_H
#define _RESTCLIENT_H 1

#include <string>
#include <curl/curl.h>

#include "Response.h"
#include "Request.h"

namespace http {
  class RestClient
  {
    public:
      // Constructors
      RestClient(const std::string &);

      // Destructor
      ~RestClient() {curl_easy_cleanup(curl_handle);}

      // Object methods
      http::Response* get(const std::string &);
      http::Response* post(const std::string &, const http::Request &) const;

      // Static methods
      static size_t write_data(void *, size_t, size_t, std::string *);

    private:
      std::string uri_base;
      CURL *curl_handle;
      std::string response_head;
      std::string response_body;
  };
}

#endif /* !_RESTCLIENT_H */
